<template>
	<div class='map_parent'>
		<div :id='detail.messageId+key' class="map_v">
		</div>
		<div class='map_address'>
			{{address}}
		</div>
	</div>
</template>

<script>
	export default {
		name: 'm-map',
		props: ["detail"],
		data() {
			return {
				address: "",
				key:new Date().getTime()
			}
		},
		mounted() {
			console.log(this.detail)
			var map = new BMap.Map(this.detail.messageId+this.key);
			let info = JSON.parse(this.detail.value)
			console.log(info,'地址信息',this.detail);
			info=eval('('+info+')');
			console.log(info,'地址信息啊');
			this.address = info.address;
			var point = new BMap.Point(info.mapLng, info.mapLat)
			map.centerAndZoom(point, 18)
			var marker = new BMap.Marker(point); // 创建标注
			map.addOverlay(marker); // 将标注添加到地图中
			marker.setAnimation(BMAP_ANIMATION_BOUNCE); 
			map.enableScrollWheelZoom(); 
			this.$forceUpdate()
		}
	}
</script>